﻿import axios from 'axios';
import router from '../router';
import request from '@/utils/request';

export function fetchClassList() {
  return request({
    url: '/api/teaching/classes',
    method: 'get'
  });
}

export function fetchStudentList(classId, page = 1, pageSize = 10) {
  return request({
    url: '/api/teaching/class-students',
    method: 'get',
    params: {
      classId,
      page,
      pageSize
    }
  });
}

export function fetchStudentListByClassName(className, page = 1, pageSize = 50) {
  return request({
    url: '/api/teaching/students-by-class',
    method: 'get',
    params: {
      className,
      page,
      pageSize
    }
  });
}

export function fetchStudentAnalysis(studentId, subject) {
  return request({
    url: '/api/teaching/student-analysis',
    method: 'get',
    params: {
      studentId,
      subject
    }
  });
}

export function fetchExamRecords(studentId) {
  return request({
    url: '/api/teaching/exam-records',
    method: 'get',
    params: {
      studentId
    }
  });
}

export function submitClassAnalysis(analysisData) {
  return request({
    url: '/api/teaching/student-analysis/submit',
    method: 'post',
    data: analysisData
  });
}

export function aiAnalysis(data) {
  return request({
    url: '/api/teaching/ai-analysis',
    method: 'post',
    data
  });
}

export function saveAiAnalysis(data) {
  return request({
    url: '/api/teaching/ai-analysis/save',
    method: 'post',
    data
  });
}
